﻿using System.Security.Principal;
using Microsoft.AspNet.Identity;
using SDCloudSolution.SDCloud.Web.Infrastructure;
using SDCloudSolution.SDCloud.Web.IoC;

namespace SDCloudSolution.SDCloud.Web.Utils
{
    public static class UserIdentityHelper
    {
        public static UserIdentity ParseUserIdentity(IPrincipal identity)
        {
            return new UserIdentity
            {
                UserId = identity.Identity.GetUserId<int>(),
                UserName = identity.Identity.GetUserName()
            };
        }
    }
}